package com.gitee.wsl.doc.prosemirror.model.content

import com.gitee.wsl.base.Overlap
import com.gitee.wsl.ext.base.overlap

typealias ResolvedPosRange = Pair<ResolvedPos,ResolvedPos>

val ResolvedPosRange._from
    get() = first

val ResolvedPosRange._to
    get() = this.second

val ResolvedPosRange.fromPos
    get() = first.pos

val ResolvedPosRange.toPos
    get() = this.second.pos

private val ResolvedPosRange.range get() = first.pos .. second.pos

fun ResolvedPosRange.overlap(target: IntRange): Overlap = this.range.overlap(target)

fun ResolvedPosRange.overlap(target: ResolvedPosRange): Overlap = this.range.overlap(target.range)